package day13_net.com.itheima.d1_inetAddress;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;

public class Demo1_InetAddress {
    public static void main(String[] args) throws IOException {
        InetAddress ip = InetAddress.getLocalHost();
        System.out.println("ip.getHostAddress() = " + ip.getHostAddress());
        System.out.println("ip.getHostName() = " + ip.getHostName());

        InetAddress ip2 = InetAddress.getByName("www.baidu.com");
        System.out.println("ip2.getHostAddress() = " + ip2.getHostAddress());
        System.out.println("ip2.getHostName() = " + ip2.getHostName());

        System.out.println("ip2.isReachable(5000) = " + ip2.isReachable(5000));
    }
}
